{% macro display_all_domains(managedDomains=[], allDomains=[]) -%}
<div class="columns clear">
    <div class="col2-3">
        <div class="form-field clear">
            <h4 class="size-250 fl-space">{{ _('Managed Domains') }}</h4>
            <div class="checklist clear">
                <fieldset>
                    {% for domain in allDomains %}
                    {% set domainName = domain[1].get('domainName')[0] %}
                    <div class="clear">
                    <div class="checklist-item">
                        <span class="fl-space">
                            <input type="checkbox" name="domainName" value="{{ domainName |e }}" {% if domainName in managedDomains %}checked{%endif%} />
                        </span>
                        <label>
                            {% if domain[1].has_key('cn') %}
                                {{ _("%s (%s)") |format(domainName |e, domain[1].get('cn')[0].decode('utf-8') |e) }}
                            {% else %}
                                {{ domainName |e }}
                            {% endif %}
                        </label>
                    </div>
                    </div>
                    {% endfor %}
                </fieldset>
            </div>
        </div>
    </div>{#-- .col2-3 --#}

    <div class="col1-3 lastcol">
        <div class="mark_blue bt-space10">
            <ul class="standard clean-padding bt-space10">
                <li class="bt-space5"><a href="{{ctx.homepath}}/create/domain" class="action_add">{{ _('Add domain') }}</a></li>
            </ul>
        </div>
    </div>
</div>{#-- .columns --#}
{%- endmacro %}

{% macro display_all_admins(domainAdmins=[], allAdmins=[]) -%}
    <div class="form-field clear">
        <h4 class="size-250 fl-space">{{ _('Domain Admins') }}</h4>
        <div class="checklist clear">
            <fieldset>
            {% for (dn, entry) in allAdmins %}
                {% set mail = entry.get('mail')[0] |e %}
                <div class="clear">
                <div class="checklist-item">
                    <span class="fl-space"><input type="checkbox" name="domainAdmin" value="{{ mail }}" {% if mail in domainAdmins %}checked{%endif%} class="checkbox" rel="checkboxhorizont" /></span>
                    <label>
                        {{ entry.get('cn')[0].decode('utf-8') }} (<a href="{{ctx.homepath}}/profile/admin/general/{{ mail }}" target="_blank">{{ mail }}</a>{% if 'yes' in entry.get('domainGlobalAdmin', []) %}, {{ _('Global Admin') }}{% endif %})
                    </label>
                </div>
                </div>
            {% endfor %}
            </fieldset>
        </div>
    </div>
{%- endmacro %}

